<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListGenBankTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form id="form" styleClass="form list">
                <p:fieldset  legend="GenBank Details" >
                    <p:commandButton  value="New GenBank" icon="ui-icon-plus" action="#{genBankController.prepareCreate}" />
                     <p:separator/>
                    <p:dataTable id="genbanks"
                                 styleClass="data"
                                 var="gb"
                                 rowKey="#{gb}"
                                 value="#{genBankController.items}"
                                 selection="#{genBankController.current}"
                                 selectionMode="single"
                                 rows="8"
                                 paginator="#{genBankController.items.size() gt 8}"
                                 >
                        <f:facet name="header">
                            <h:outputText value="GenBanks"></h:outputText>
                        </f:facet>
                        <p:column sortBy="#{gb.definition}" filterBy="#{gb.definition}">
                            <f:facet name="header">
                                <h:outputText value="Definition"/>
                            </f:facet>
                            <h:outputText value="#{gb.definition}"/>
                        </p:column>
                        <p:column sortBy="#{gb.version}" filterBy="#{gb.version}">
                            <f:facet name="header">
                                <h:outputText value="Version"/>
                            </f:facet>
                            <h:outputText value="#{gb.version}"/>
                        </p:column>
                        <p:column sortBy="#{gb.creationDate}" filterBy="#{gb.creationDate}">
                            <f:facet name="header">
                                <h:outputText value="Creation"/>
                            </f:facet>
                            <h:outputText value="#{gb.creationDate}">
                            </h:outputText>
                        </p:column>
                        <f:facet name="footer">
                            <h:outputText id="rowCount"
                                          value="Total number of records: #{genBankController.items.size()}" />
                            <br />
                            <p:commandButton ajax="false" action="#{genBankController.prepareCreate}" value="New" icon="ui-icon-plus" rendered="#{empty genBankController.items}"/>
                        </f:facet>
                    </p:dataTable>
                    <p:contextMenu for="genbanks" >
                        <p:menuitem id="edit_com" value="Edit" icon="ui-icon-pencil"   action="#{genBankController.prepareEdit}" />
                        <p:menuitem id="rem_com" value="Delete" icon="ui-icon-close" actionListener="#{genBankController.destroy}" update=":form:"/>
                        <p:menuitem id="view_com" value="View" icon="ui-icon-search" action="#{genBankController.prepareView}"/>
                        <p:menuitem id="new_com" value="New" icon="ui-icon-plus" action="#{genBankController.prepareCreate}" />
                        <p:blockUI block=":form:" trigger="edit_com,new_com,view_com,rem_com">
                            <h:outputText value="Please wait, data is being processed..." />  <br/>
                            <p:graphicImage value="/resources/ajaxloader.gif"/>
                        </p:blockUI>
                    </p:contextMenu>
                </p:fieldset>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
